package com.dabai.iot.core.utils;

import com.dabai.common.tdengine.core.TDSql;

public class IotTDSql extends TDSql {

    /**
     * 设备日志超级表名
     */
    public static String getDeviceLogStbName(String tenantId, String productKey) {
        return String.join("_", "stb", "device", "log", tenantId, productKey).toLowerCase();
    }

    /**
     * 设备日志子表名
     */
    public static String getDeviceLogTableName(String productKey, String deviceSn) {
        return String.join("_", "device", "log", productKey, deviceSn).toLowerCase();
    }

    /**
     * 设备属性超级表名 - stb_device_property_xxx_xxx
     */
    public static String getDevicePropertyStbName(String productKey, String blockIdentifier) {
        return String.join("_", "stb", "device", "property", productKey, blockIdentifier).toLowerCase();
    }

    /**
     * 设备属性子表名
     */
    public static String getDevicePropertyTableName(String productKey, String blockIdentifier, String deviceSn) {
        return String.join("_", "device", "property", productKey, blockIdentifier, deviceSn).toLowerCase();
    }

}
